Skip to main content
Version: 2.0

Rich Media Template

This allows you to send media with provided template. User will receive the media along with template message configured. Template whitelisting is required in advance.

Case: Template with Image and Variables

Payload

{
"recipient_type": "individual",
"to": "918892532751",
"type": "template",
"template": {
"name": "test_msg_img_dynamic",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Sinch"
},
{
"type": "text",
"text": "100"
}
]
}
]
},
"metadata": {
"messageId": "xxxxx",
"transactionId": "xxxxx",
"callbackDlrUrl": "https:xxx.com",
"media": {
"mimeType": "image/jpeg"
}
}
}

Note: 'type' field will have the value as 'mediaTemplate', 'contentType' field will have the value as 'image/jpeg' or 'image/png' and 'templateID' field refers to template name which should be passed in small characters only. Also, the value in 'callbackDlrUrl' will be honoured only if default DLR URL is configured for you business.

Case: Template with Document

Payload

{
"recipient_type": "individual",
"to": "919999XXXXXX",
"type": "template",
"template": {
"name": "test_msg_pdf",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "document",
"document": {
"link": "https://www.incometaxindia.gov.in/circular_9_2021.pdf",
"filename": "Sunny file"
}
}
]
}
]
},
"metadata": {
"messageId": "xxxxx",
"callbackDlrUrl": "http://xxx.com",
"media": {
"mimeType": "application/pdf"
}
}
}

Note: 'type' field will have the value as 'mediaTemplate', 'contentType' field will have the value as 'application/pdf' and 'templateID' field refers to template name which should be passed in small characters only. Also, the value in 'callbackDlrUrl' will be honoured only if default DLR URL is configured for you business.

Case: Template with Video

Payload

{
"recipient_type": "individual",
"to": "919999XXXXXX",
"type": "template",
"template": {
"name": "test_msg_video",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "video",
"video": {
"link": "https://www.sample-url.com/Galaxy Video.mp4"
}
}
]
}
]
},
"metadata": {
"messageId": "xxxxx",
"callbackDlrUrl": "http://xxx.com",
"media": {
"mimeType": "video/mp4"
}
}
}

Note: 'type' field will have the value as 'mediaTemplate', 'contentType' field will have the value as 'video/mp4' and 'templateID' field refers to template name which should be passed in small characters only. Also, the value in 'callbackDlrUrl' will be honoured only if default DLR URL is configured for you business.

Case: Media Content in 'base64' for Outbound Message Template

Payload

{
"recipient_type": "individual",
"to": "9178XXXXXXXX",
"type": "template",
"template": {
"name": "TemplateId",
"language": {
"policy": "deterministic",
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "document",
"document": {
"filename": "sample-doc"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "hi"
}
]
}
]
},
"metadata": {
"messageId": "xxxxx",
"media": {
"mimeType": "application/pdf",
"content": "JVBERi0xLjMNCiXi48/TDQoNCjEgMCBvYmoNCjw8DvV"
}
}
}

Note: In above example the content shown in 'base64' format is just for reference purpose to highlight where to provide the 'base64' information.

Note: Calback URL is a optional paramter . Please use when you want to change the default URL(configured through smartta). It will only chnage the domain name othere paratemters will be same as configurated in smartta.